package com.jiang.jetpackdemo.fragment

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.jiang.jetpackdemo.model.VideoRecommendInfo

class VideoRecommendViewModel : ViewModel() {
    val videoInfoList: MutableLiveData<MutableList<VideoRecommendInfo.ResultBean>> =
        MutableLiveData()
    val videoInfoListSize: MutableLiveData<Int> = MutableLiveData()

    init {
        videoInfoList.value = ArrayList()
        changeSize()
    }

    private fun changeSize() {
        videoInfoListSize.value = videoInfoList.value?.size ?: 0
    }

    fun resetVideoInfoList(list: MutableList<VideoRecommendInfo.ResultBean>) {
        // val resultBean = videoInfoList.value?.get(0)
        videoInfoList.value?.clear()
        videoInfoList.value?.addAll(list)
        // val newBean = videoInfoList.value?.get(0)
        changeSize()
    }

}
